package com.xyzwps.orm.jooq.repository;

import com.xyzwps.orm.repository.TablesRepository;
import org.jooq.DSLContext;

import java.util.Objects;

import static org.jooq.impl.DSL.*;

public class JooqTablesRepository implements TablesRepository {

    private final DSLContext context;

    public JooqTablesRepository(DSLContext ctx) {
        this.context = Objects.requireNonNull(ctx);
    }

    @Override
    public void cleanAllTables() {
        context.deleteFrom(table("tag")).execute();
        context.deleteFrom(table("user")).execute();
    }
}
